<?php

// 收藏表

namespace app\shop\model;

use think\Model;

class MemberCollect extends Model
{
    // 会员收藏 商品表 关联
    public function ShopGoods()
    {
        return $this->hasOne('ShopGoods','id','collect_id')->where('state',1)->field('id,title,thumb_img,price,hits,collect');
    }

    // 会员收藏 店铺 店铺商品 远程一对多
    // public function Shop()
    // {
    //     return $this->hasManyThrough('ShopGoods','Shop','collect_id','member_id','member_id');
    // }

    // 会员收藏 店铺 关联
    public function Shop()
    {
        return $this->belongsTo('Shop','collect_id','member_id')->field('member_id,title,logo,url,collect_number');
    }

}